package demo.day08.work_Bank;

import java.io.IOException;

/**
 * @Auther: hjy(lc))
 * @Date: 2022/7/26-07-26-19:16
 * @Description：demo.day08.work_Bank
 */
public class Account {
    double balance;

    public Account() {
    }

    public Account(Double balance) {
        this.balance = balance;
    }
    public boolean deposit(double amount){
        balance = balance + amount;
        return true;
    }
    public boolean withdraw(double amount) {
        if(balance<amount){
            System.out.println("取款金额过大，已超过现有余额，取款失败，当前余额为：" + balance );
            return false;
        }else{
            balance = balance - amount;
            System.out.println("成功取款" + amount + "元！");
            return true;
        }

    }

    public double getBalance() {
        return balance;
    }
}
